/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Util;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import javax.swing.JPanel;

/**
 * Classe para personagens com mais de 1 imagem
 * @author Lucas
 */
public class Sprites implements Drawable {
    Image img;
    Image[] imgs;
    int x, y, status;
    Rectangle r;

    public Sprites(String nome, int x, int y, int quantidade) {
        status = 0;
        this.x = x;
        this.y = y;
        imgs = new Image[quantidade];
        for (int i = 0; i < quantidade; i++) {
            imgs[i] = ImageReader.read("/Imagens/" + nome + i + ".png");
        }
        img = imgs[0];
        r = new Rectangle(x, y, img.getWidth(null), img.getHeight(null));
    }

    public Image getImage() {
        return img;
    }

    public void setPos(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getStatus() {
        return status;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }
    
    public Rectangle getRect(){
        return r;
    }

    @Override
    public void draw(Graphics2D g, JPanel jp) {
        g.drawImage(img, x, y, jp);
    }
}
